def demo_app():
    from bcat.process.executables import Python
# check & start server_process 
    script_path = "/home/chenglun/dev/bcat/src/backend/local/demo/common_server_app_demo.py"
    process = Python.default().execute(script_path)

#wait process start 
    import time
    time.sleep(4) 
    print("wait ok")

# new ServerProxy 
    from bcat.rpc.client.server_proxies.common_server_proxy import CommonServerProxy
    from bcat.rpc.client.server_proxy_impls.jsonrpclib_server_proxy_impl import JsonRpcLibServerProxyImpl
    url = "http://127.0.0.1:5000/api"
    sp = CommonServerProxy(url, JsonRpcLibServerProxyImpl(url))
    while True:
        time.sleep(1) 
        print(sp.tick())


# wait the process exit
    process.terminate().wait(4)





demo_app()
